<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>AOI检验数据分析</title>
		<link rel="stylesheet" type="text/css" href="../../css/style.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/list.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/layui.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/jquery-ui.css" /
	</head>
	<body>
		<!-- 蓝色背景区域 -->
		<div class="wrap">
			<!-- 白色可用区域 -->
			<div class="canuse">
				<!------ 位置 ------>
	            <p class="contentText local"><span>位置：质量分析管理 > AOI检验数据分析</span></p>
	            
	            <!------ tab标签 ------>
	            <div class="layui-tab layui-tab-card">
				  <!--  <ul class="layui-tab-title">
					    <li class="layui-this">AOI统计分析</li>
				    </ul>-->
					<div class="layui-tab-content">
					    <div class="layui-tab-item layui-show">
					    	<div class="content">
								<!-- 搜索区 -->
								<div class="search_area">
									<h4 class="sel_title"><img src="../../img/list/brand1.png" /><span>PCB查询条件</span></h4>
									<div class="select_area">
										<div class="select_text clear">
											<div class="label_input">
					                            <label class="contentText">起始编号：</label> <input type="text" name=""  />
											</div>
											<div class="label_input">
					                            <label class="contentText">终止编号：</label> <input type="text" name="" />
				                        	</div>
				                        	<div class="label_input">
					                            <label class="contentText">起始时间：</label> <input type="text" name="" class="dateControl" id="dateControl2" readonly="readonly" />
				                        	</div>
				                        	<div class="label_input">
					                            <label class="contentText">终止时间：</label> <input type="text" name="" class="dateControl" id="dateControl3" readonly="readonly" />
				                        	</div>
											<div class="floatLeft">
					                            <button class="btn_search bgd_blue_search">查询</button>
					                            <button class="btn_clear bgd_white_clear">重置</button>
				                            </div>
										</div>
									</div>
								</div>
					            <!-- 列表区 -->
					            <div class="show_list">
				                	<div class="title_operate">
				                    	<h4 class="sel_title"><img src="../../img/list/brand1.png" /><span>AOI统计分析图表</span></h4>
				                	</div>
				                	<div class="list_area clear">
					                	<!-- 信息列表区 -->
				                        <div class="info_area">
			                        		<table class="tablelist" border="1" cellspacing="0" cellpadding="0">
				                                <tbody>
				                                    <tr class="menuText list_head">
				                                        <th class="">PCB数量（个）</th>
				                                        <th class="">OK数量（个）</th>
				                                        <th class="">NG数量（个）</th>
				                                        <th class="">PPM</th>
				                                        <th class="">元件数量（个）</th>
				                                        <th class="">初判NG数量（个）</th>
				                                        <th class="">确认NG数量（个）</th>
				                                        <th class="">DPMO</th>
				                                    </tr>
				                                </tbody>
				                                <tbody class="tablelist" id="tableflow">
				                                    <tr class="listTableText list_list">
				                                        <td>4</td>
				                                        <td>4</td>
				                                        <td>0</td>
				                                        <td>0</td>
				                                        <td>786</td>
				                                        <td>14</td>
				                                        <td>0</td>
				                                        <td>0</td>
				                                    </tr>
				                                </tbody>
				                            </table>
				                        </div>
				                        <!-- 图表区 -->
				                        <div class="info_area_left2">
				                        	<h4>AOI缺陷统计分析</h4>
				                        	<!-- echarts图表显示区域 -->
				                        	<div class="charts1" id="graph1"></div>
				                        </div>
				                        <!-- 信息列表区 -->
				                        <div class="info_area_right2">
				                        	<h4>AOI异常统计</h4>
			                        		<table class="tablelist" border="1" cellspacing="0" cellpadding="0">
				                                <tbody>
				                                    <tr class="menuText list_head">
				                                        <th class="list_th01">名称</th>
				                                        <th class="list_th02">数量（个）</th>
				                                    </tr>
				                                </tbody>
				                                <tbody class="tablelist" id="tableflow">
				                                    <tr class="listTableText list_list">
				                                        <td>错位</td>
				                                        <td>5</td>
				                                    </tr>
				                                    <tr class="listTableText list_list">
				                                        <td>偏移</td>
				                                        <td>3</td>
				                                    </tr>
				                                    <tr class="listTableText list_list">
				                                        <td>缺焊</td>
				                                        <td>2</td>
				                                    </tr>
				                                    <tr class="listTableText list_list">
				                                        <td>虚焊</td>
				                                        <td>0</td>
				                                    </tr>
				                                    <tr class="listTableText list_list">
				                                        <td>立杯</td>
				                                        <td>2</td>
				                                    </tr>
				                                </tbody>
				                            </table>
				                        </div>
				                    </div>
								</div>
								<!-- 列表区 -->
								<div class="show_list">
									<div class="title_operate">
										<h4 class="sel_title"><img src="../../img/list/brand1.png" /><span>AOI检测结果列表</span></h4>
									</div>
									<div class="list_area clear">
										<!-- 信息列表区 -->
										<div class="info_area">
											<table class="tablelist" border="1" cellspacing="0" cellpadding="0">
												<tbody>
													<tr class="menuText list_head">
														<th class="">PCB编号</th>
														<th class="">元件数量</th>
														<th class="">产品名称</th>
														<th class="">初判NG数量（个）</th>
														<th class="">确认NG数量（个）</th>
														<th class="">检测结果</th>
														<th class="">检测日期</th>
													</tr>
												</tbody>
												<tbody class="tablelist" id="tableflow">
													<tr class="listTableText list_list">
														<td class="cursor editBlue" onclick="rolledYieldShow();">DD201804-1</td>
														<td>100</td>
														<td>长远银</td>
														<td>12</td>
														<td>1</td>
														<td style="color: green;">OK</td>
														<td>2018-08-25</td>
													</tr>
													<tr class="listTableText list_list">
														<td class="cursor editBlue" onclick="rolledYieldShow();">DD201804-2</td>
														<td>100</td>
														<td>长远银</td>
														<td>12</td>
														<td>5</td>
														<td style="color: red;">NG</td>
														<td>2018-08-25</td>
													</tr>
													<tr class="listTableText list_list">
														<td class="cursor editBlue" onclick="rolledYieldShow();">DD201804-3</td>
														<td>100</td>
														<td>长远银</td>
														<td>12</td>
														<td>10</td>
														<td style="color: red;">NG</td>
														<td>2018-08-25</td>
													</tr>
												</tbody>
											</table>
										</div>
										<!-- 页码区域 -->
										<div class="page_area contentText clear">
											<div class="page_sum">
												共<span class="page_number"> 3 </span>页&emsp;每页 10 条&emsp;共<span class="info_sum"> 27 </span>条记录
											</div>
											<div class="page_jump">
												<span>跳转到&emsp;第</span>
												<input type="text" name="" id="" value="" />
												<span>页&emsp;</span>
												<button>Go</button>
											</div>
											<div class="page-pull-right async-page">
												<button>上一页</button>
												<button class="select_page">1</button>
												<button>2</button>
												<button>3</button>
												<button style="color: rgb(30, 30, 30);">▪▪▪</button>
												<button>98</button>
												<button>99</button>
												<button>100</button>
												<button>下一页</button>
											</div>
										</div>
									</div>
								</div>
	
					    	</div>
						</div>
					</div>
				</div>
			</div>
			<!-- 版尾  -->
			<div class="ending">
				Copyright© 2019-2020 磐基技术有限公司
			</div>
			
			<!-- AOI检测结果PCB信息弹框 -->
			<div class="testResult hidden">
				<div class="testResult_content">
					<p class="testResult_title">AOI检测PCB信息
						<img onclick="testResultClose();" src="../../img/list/delete.png"/>
					</p>
					
				</div>
			</div>
			
			<!-- AOI检测结果弹框 -->
			<div class="rolledYield hidden">
				<div class="rolledYield_content">
					<p class="rolledYield_title">AOI检测结果
						<img onclick="rolledYieldClose();" src="../../img/list/delete.png"/>
					</p>
					<!-- 信息列表区 -->
                    <div class="overflowDiv">
                		<table class="tablelist" border="1" cellspacing="0" cellpadding="0">
                            <tbody>
                                <tr class="menuText list_head">
                                    <th class="">PCB编号</th>
									<th class="">元件序号</th>
									<th class="">NG名称</th>
									<th class="">元件位置</th>
									<th class="">元件名称</th>
									<th class="">初判NG</th>
									<th class="">料号</th>
                                </tr>
                            </tbody>
                            <tbody class="tablelist" id="tableflow">
                                <tr class="listTableText list_list">
                                    <td>DD201804-1</td>
                                    <td>2</td>
                                    <td>立杯</td>
                                    <td>1611-2</td>
                                    <td>芯片</td>
                                    <td>5</td>
                                    <td>1143</td>
                                </tr>
                            </tbody>
                        </table>
                        <div id="rolledYield_img1">
							<img src="../../img/list/charts7.png"/>
                        </div>
                    </div>
				</div>
			</div>
			
		</div>
	</body>
	<script src="../../js/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../js/frame/common.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../js/layui.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../js/3rd/jquery-ui.js" type="text/javascript"></script>
	<script src="../../js/echarts.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		var h = document.documentElement.clientHeight;
		$(".wrap").css("height", h);
		
		// 获取每行 td 的兄弟节点
		$("td").hover(   
			function () {      
				$(this).parent().children().addClass("td_hover");   
			},    
			function () {      
				$(this).parent().children().removeClass("td_hover");   
			}
		);
		
		// 日期控件
		$(function(){
	        $(".dateControl").datepicker({
	        	dateFormat : 'yy-mm-dd',
	            monthNamesShort:["January","February","March","April","May","June", "July","August","September","October","November","December"],
	 		 	changeYear:true,
	 		 	changeMonth:true,
	 		 	showOn:"button",
	 		 	buttonImage:"../../img/button/calendar.png",
	 		 	buttonImageOnly:false
	        });
	     });
		
		//点击右上角关闭弹框
		function testResultClose(){
			$(".testResult").css("display", "none");
		}
		//点击计划显示弹框
		function testResultShow(){
			$(".testResult").css("display", "block");
		}
		
		//点击右上角关闭弹框
		function rolledYieldClose(){
			$(".rolledYield").css("display", "none");
		}
		//点击计划显示弹框
		function rolledYieldShow(){
			$(".rolledYield").css("display", "block");
		}
		
		//删除规则
	    function delUserGroup() {
			
	        var list = [];
	        var checks = $("input[name='ids']:checked");
	        $.each(checks, function(index, obj) {
	            list.push(obj.id);
	        });
	        if (!list.length > 0) {
	            alert("请选择要删除的内容");
	            return;
	        }
	        if (!confirm("确定要删除所选用户组吗？")) {
	            return;
	        }
	        alert("提醒:删除时，正在使用的用户组将无法删除！");
	        $.ajax({
	            type : 'POST',
	            url : 'userGroup/delUserGroup',
	            data : JSON.stringify(list),
	            contentType : 'application/json; charset=utf-8',
	            async : true,
	            cache : false,
	            success : function(data) {
	                alert(data == 'success' ? "删除成功" : "被使用：无法删除!!!");
	                if (data != 'success') {
	                    return;
	                }
	
	                var current = PageUtils._currentPage['userGroupPage'];
	                PageUtils.pageClick(current, 'userGroupPage');
	            }
	
	        });
	    }
	    
	    layui.use('element', function(){
			var $ = layui.jquery, 
			    element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
			  
		    //触发事件：添加、删除、切换
		    var active = {
			    tabAdd: function(){
			        //新增一个Tab项
			        element.tabAdd('demo', {
			        	title: '新选项'+ (Math.random()*1000|0), 
			        	content: '内容'+ (Math.random()*1000|0),
			        	id: new Date().getTime() //实际使用一般是规定好的id，这里以时间戳模拟下
			        })
			    },
			    tabChange: function(){
			        //切换到指定Tab项
			        element.tabChange('demo', '22'); //切换到：“用户管理”
			    }
		    };
		  
		    $('.site-demo-active').on('click', function(){
		    	var othis = $(this), 
		        	type = othis.data('type');
		    	active[type] ? active[type].call(this, othis) : '';
		    });
		  
		    //Hash地址的定位
		    var layid = location.hash.replace(/^#test=/, '');
		    element.tabChange('test', layid);
		  
		    element.on('tab(test)', function(elem){
		   		location.hash = 'test='+ $(this).attr('lay-id');
		    });
		});

		function showGraph1(){
			var myChart = echarts.init(document.getElementById('graph1'));
			var option = {
			    tooltip: {
			        trigger: 'axis',
			        axisPointer: {
			            type: 'cross',
			            crossStyle: {
			                color: '#999'
			            }
			        },
					formatter: function(params) {
								return params[0].name + '<br/>' +
									params[0].seriesName + ' : ' + params[0].value + '<br/>' +
									params[1].seriesName + ' : ' + (params[1].value + "%");
							}
					    },
			    legend: {
			        selectedMode: false,
			        data:['异常占比','异常次数']
			    },
				grid: {//绘图网格
						left: '8%',
						right: '10%',
						top: '15%',
						bottom: '5%',
						containLabel: true
					},
			    xAxis: [
			        {
			            type: 'category',

			            //显示横坐标中对应值的坐标线（竖线）：默认不显示
			            //splitLine:{show:true},
			            data: ['错位', '偏移', '缺焊', '虚焊', '立杯'],
			            splitLine:false
			        },{
			            type: 'category',
			            show:false,
			            boundaryGap : false,
			            data: ['错位', '偏移', '缺焊', '虚焊', '立杯'],
			            splitLine:false
			        }
			    ],
			    yAxis: [
			        {
			            type: 'value',

			             splitLine:false, //纵坐标轴上的各个值对应的横线是否显示：默认显示
			            name: '异常占比(%)',
			            min: 0,
			            max: 100,
			            interval: 50,
			            axisLabel: {
			                formatter: '{value} %'
			            }
			        },
			        {
			            type: 'value',
			            name: '异常次数',
			            splitLine:false, //纵坐标轴上的各个值对应的横线是否显示：默认显示
			        }
			    ],
			    series: [
			        {
			            name:'异常次数',
			            type:'bar',
						barWidth: 50,
			            //设置柱状图的颜色
			            itemStyle: {
			                normal: {
			                    color: 'blue'

			                    //设置柱状图边框线颜色
			                    //barBorderColor: 'black',
			                    //设置柱状图边框线的显示宽度
			                    //barBorderWidth:0.5
			                }
			            },
			            data:[4, 40, 30, 20, 16]
			        },
			        {
			            name:'异常占比',
			            type:'line',
			            //显示数字
			            itemStyle : 
			            { 
			                normal: {
			                    label : 
			                    {
			                        show: true,
			                        //格式化
			                        formatter: '{c}%'
			                    }
			                }
			            },
			            xAxisIndex: 1,
			            yAxisIndex: 1,
			            data:[4, 40, 30, 20, 16]
			        }
			    ]
			};

			myChart.setOption(option);	
		}

		showGraph1();
	</script>
</html>
